﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zocono.WCS.Domain.EntityInfo;
using Zocono.WCS.Domain.RouteDomain;
using Zocono.WCS.Infrastructure.ApllicationDto.WCSTaskDto;
using Zocono.WCS.Infrastructure.ApllicationDto;
using AutoMapper;

namespace Zocono.WCS.Application.AppConfigureManage
{
    public class RouteDetailInfoApp
    {
        private IRouteDetailInfoService _RouteDetailInfoService;
        private IMapper _Mapper;
        public RouteDetailInfoApp(IRouteDetailInfoService routeDetailInfoService, IMapper mapper)
        {
            _RouteDetailInfoService = routeDetailInfoService;
            _Mapper = mapper;
        }

        public async Task<PageDto<RouteDetailInfoDto>> GetPagedRouteDetailInfoAsync(QueryRouteDetailInfoDto queryRouteDetailInfo)
        {
            return await _RouteDetailInfoService.GetPagedRouteDetailInfoAsync(queryRouteDetailInfo);
        }
        public async Task<List<RouteDetailInfo>> GetRouteDetailInfoByRouteIDAsync(long routeId)
        {
            return await _RouteDetailInfoService.GetRouteDetailInfoByRouteIDAsync(routeId);
        }
        public async Task<bool> CreateRouteDetailInfoAsync(RouteDetailInfoDto routeDetailInfo)
        {
            RouteDetailInfo routeDetail = new RouteDetailInfo();
            _Mapper.Map(routeDetailInfo, routeDetail);
            return await _RouteDetailInfoService.CreateRouteDetailInfoAsync(routeDetail);
        }
        public async Task<bool> ModifyRouteDetailInfoAsync(RouteDetailInfo routeDetailInfo)
        {
            return await _RouteDetailInfoService.ModifyRouteDetailInfoAsync(routeDetailInfo);
        }
        public async Task<bool> ModifyRouteDetailInfoAsync(RouteDetailInfoDto routeDetailInfoDto)
        {
            RouteDetailInfo routeDetail = new RouteDetailInfo();
            _Mapper.Map(routeDetailInfoDto, routeDetail);
            return await _RouteDetailInfoService.ModifyRouteDetailInfoAsync(routeDetail);
        }

        public async Task<bool> DeleteRouteDetailInfoAsync(List<RouteDetailInfo> routeDetailInfoList)
        {
            return await _RouteDetailInfoService.DeleteRouteDetailInfoAsync(routeDetailInfoList);
        }

        public async Task<List<RouteDetailInfo>> GetRouteDetailInfoByDetailIDAsync(long routeDetailInfoId)
        {
            return await _RouteDetailInfoService.GetRouteDetailInfoByDetailIDAsync(routeDetailInfoId);
        }

        public async Task<RouteDetailInfo> GetRouteDetailInfoByIdAsync(long Id)
        {
            return await _RouteDetailInfoService.GetRouteDetailInfoByIdAsync(Id);
        }
        /// <summary>
        /// 根据id删除数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<bool> DeleteRouteDetailInfoByIdAsync(long id)
        {
            return await _RouteDetailInfoService.DeleteRouteDetailInfoByIdAsync(id);
        }

        /// <summary>
        /// 一次性添加路径详情
        /// </summary>
        /// <param name="routeDetailInfo"></param>
        /// <returns></returns>
        public async Task<long> CreateRouteDetailInfoOutIdAsync(RouteDetailInfoDto routeDetailInfo)
        {
            RouteDetailInfo routeDetail = new RouteDetailInfo();
            _Mapper.Map(routeDetailInfo, routeDetail);
            return await _RouteDetailInfoService.CreateRouteDetailInfoOutIdAsync(routeDetail);
        }
    }
}
